/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function () {	
	
	$('#category-menu li').hover(
		function () {
			//mostra sottomenu
			$('ul', this).stop(true, true).delay(50).slideDown(100);

		}, 
		function () {
			//nascondi sottomenu
			$('ul', this).stop(true, true).slideUp(200);		
		}
	);
            
            
	$('#registerLink').click(
            function(){
                $('#registerForm').fadeIn('slow');
                $('#loginForm').fadeOut('slow');
                $('#registerLink').fadeOut('slow');
                $('#loginLink').fadeIn('slow');
        });
        
        $('#loginLink').click(
            function(){
                $('#loginForm').fadeIn('slow');
                $('#registerLink').fadeIn('slow');
                $('#registerForm').fadeOut('slow');
                $('#loginLink').fadeOut('slow');
            }
        );
        
        
        $('#loginButton').click(
                function(){
                    var userName=$("input[name='UserName']").val();
                    var password=$("input[name='Password']").val();
                    alert(userName);
                    alert(password);
                    $.post("UserServlet",
                        {"op":"login","userName":userName,"password":password},
                        function(data){
                            alert(data);
                        }
                    ).fail(function(){alert("error");});
                }
        );

});


